package turistic.GUI.graphic;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class BeszamoloActivity extends Activity {
	String mess;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.beszamolo);

		Button save = (Button) findViewById(R.id.save);
		save.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				TextView start = (TextView) findViewById(R.id.start);
				String startStr = start.getText().toString();

				TextView finish = (TextView) findViewById(R.id.finish);
				String finishStr = finish.getText().toString();

				EditText text = (EditText) findViewById(R.id.text);
				String textStr = text.getText().toString();

				String mess = "A kovetkezo utvonalat tettem meg : \n"
						+ "Kiindulo pont : " + startStr + "\n " + "Vegpont : "
						+ finishStr + "\n " + "Elmenyek : " + textStr;

				Intent intent = new Intent(BeszamoloActivity.this,
						ShareOnFacebook.class);
				intent.putExtra("ComingFrom", mess);
				final int result = 1;
				startActivityForResult(intent, result);

			}
		});

	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
			startActivity(new Intent(BeszamoloActivity.this,
					ParamActivity.class));
			return true;
		}

		return super.onKeyDown(keyCode, event);
	}

	public String getMess() {
		return mess;
	}

}
